from flask import request
from create_app import app,db
from TaskSceduling import TaskScheduling,example_task
task_scheduling = TaskScheduling()
# 创建数据库和表
@app.cli.command('create_db')
def create_db():
    db.create_all()
    return "Database and tables created!"
@app.post('/batch_add')
def add_task():
    task_params = request.json.get('task_params')
    task_scheduling.batch_add_task(task=example_task,task_params=task_params)
    return "ok"
if __name__ == '__main__':
    app.run(debug=True)
